<template>
	<view class="container">
		<template v-if="list.length>0">
			<view class="item" v-for="(item,index) in list" :key="item.id"  @click="toPath('/pages/noticedetail/index?id='+item.id+'&times='+item.time+'&content='+item.content)">
				<view class="flex flex-jcsb flex-aic">
					<view class="">公告<text class="point" v-if="item.read == 0"></text></view>
					<view class="f30 c9">{{item.time}}</view>
				</view>
				<view class="">{{item.content}}</view>
			</view>
		</template>
		<view class="nodata" v-else>
			<image src="../../static/images/nodata.png" mode=""></image>
			<view class="tac c6">暂无消息</view>
		</view>
	</view>
</template>

<script>
	export default {
		name:"",
		data() {
			return {
				list:[],
			}
		},
		onLoad() {
			this.getList();
		},

		methods: {
			getList(){
				let _this = this;
				_this.$utils.request({
					url:'/patient/message/'
				}).then(res=>{
					this.list = res.data
				})
			},
			/**
			 * @func toPath  页面跳转
			 * @param {String} url 跳转路径
			 */
			toPath(url){
				if(!this.$utils.isLogin()){
					return false;
				}
				this.$routeJump.navigateTo(url);
			}
		}
	}
	
</script>

<style lang="scss" scoped>
	.item{
		padding: 20rpx;
		border-bottom: 1rpx solid #ddd;
		.point{
			display: inline-block;
			width: 20rpx;
			height: 20rpx;
			border-radius: 50%;
			background-color: #ff8787;
			margin-left: 10rpx;
			margin-top: 10rpx;
		}
	}
</style>
